package com.xbongbong.pro.customercommunicate.pojo.dto;

import com.xbongbong.paas.domain.entity.PaasFormEntity;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 添加动态（项目日志）入参
 * @author weijianxun
 */

@Getter
@Setter
@ToString
public class DynamicDTO extends BaseDTO {
    private static final long serialVersionUID = 2506082942127580247L;

    /**
     * 客户
     */
    private Long customerId;

    /**
     * 联系人
     */
    private Long contactId;

    /**
     * 合同
     */
    private Long contractId;

    /**
     * 机会
     */
    private Long opportunityId;

    /**
     * 数据id
     */
    private Long dataId;

    private Integer businessType;

    /**
     * 关联业务数据id
     */
    private Long refId;
    /**
     * 关联业务类型
     */
    private Integer refBusinessType;
    /**
     * 关联业务数据名称
     */
    private String refName;

    /**
     * 创建者id
     */
    private String creatorId;

    /**
     * 备注
     */
    private String memo;
    /**
     * 项目日志类型
     */
    private Integer logType;

    /**
     * 填充memo中的%s
     */
    private List<String> memoPlaceHolder;

    /**
     * 表单实体
     */
    private PaasFormEntity paasFormEntity;

    /**
     * saas标识
     */
    private Integer saasMark;

    private Long addTime;

    private Long updateTime;


    public DynamicDTO() {

    }

    public DynamicDTO(String creatorId, String memo, Integer logType, List<String> memoPlaceHolder, PaasFormEntity paasFormEntity, Integer saasMark) {
        this.creatorId = creatorId;
        this.memo = memo;
        this.logType = logType;
        this.memoPlaceHolder = memoPlaceHolder;
        this.paasFormEntity = paasFormEntity;
        this.saasMark = saasMark;
    }

    public static DynamicDTO initDynamicDTO(String creatorId, String memo, Integer logType, List<String> memoPlaceHolder, PaasFormEntity paasFormEntity, Integer saasMark) {
        DynamicDTO dynamicDTO = new DynamicDTO(creatorId, memo, logType, memoPlaceHolder, paasFormEntity, saasMark);
        return dynamicDTO;
    }

    public static List<String> initMemoHolder(String... memoPlaceHolder) {
        List<String> list = new ArrayList<>();
        if (Objects.nonNull(memoPlaceHolder)) {
            list.addAll(Arrays.asList(memoPlaceHolder));
        }
        return list;
    }

}
